// 封装部门管理相关的API
import request from '@/utils/request'

/**
 * 获取部门列表
 * @returns
 */
export const getDepartmentList = () => {
  return request.get('/company/department')
}
/**
 * 获取部门负责人
 * @returns
 */
export const getDepartmentManager = () => {
  return request.get('/sys/user/simple')
}
/**
 * 获取部门详情
 * @param {string} id
 * @returns
 */
export const getDepartmentDetail = (id) => {
  return request({
    url: `/company/department/${id}`,
    method: 'get'
  })
}
/**
 * 添加部门
 * @param {object} data
 * @returns
 */
export const addDepartment = (data) => {
  console.log(data)
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}
/**
 * 编辑部门
 * @param {object} data
 * @returns
 */
export const editDepartment = (data) => {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}
/**
 * 删除部门
 * @param {string} id
 * @returns
 */
export const deleteDepartment = (id) => {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}
